﻿using DevExpress.XtraEditors;
using DXApplicationTangche.DTO;
using DXApplicationTangche.Utils.UC;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.纳客
{
    public partial class Form纳客修改折扣 : DevExpress.XtraEditors.XtraForm
    {
        private SaleOrderFacadeBillEntryDTO saleOrderFacadeBillEntryDTOs = new SaleOrderFacadeBillEntryDTO();
        private Double adjustDiscount;
        private Form纳客预览 Form纳客预览;

        public Form纳客修改折扣(SaleOrderFacadeBillEntryDTO saleOrderFacadeBillEntryDTOs,Double adjustDiscount, Form纳客预览 Form纳客预览)
        {
            InitializeComponent();
            this.saleOrderFacadeBillEntryDTOs = saleOrderFacadeBillEntryDTOs;
            this.adjustDiscount = adjustDiscount;
            this.Form纳客预览 = Form纳客预览;
            this.refreshata();
        }
        private void refreshata()
        {
            this.textBox金蝶物料名.Text = this.saleOrderFacadeBillEntryDTOs.kingdeeMaterialFnumber;
            this.textBox折扣额.Text = adjustDiscount.ToString();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            this.adjustDiscount = Convert.ToDouble(this.textBox折扣额.Text.Trim());
            SaleOrderFacadeDTO saleOrderFacadeDTO = 
                nakeService.modifyDisconut(
                    this.saleOrderFacadeBillEntryDTOs.id,
                    this.saleOrderFacadeBillEntryDTOs.entryId,
                    this.adjustDiscount
                    );
            this.Form纳客预览.refreshata(saleOrderFacadeDTO);
            MessageBox.Show("保存成功");
            this.Close();
        }
    }
}